Articles in this section
Category / Section

How to start creating and binding live data in Blazor DataGrid?

1 min read

 

 

 

 

What is Blazor Live DataGrid?

Blazor Live DataGrid is a customized DataGrid component to show the live data in Blazor applications. It is optimized for handling and updating large number of records at real-time which is suitable for binding financial records and more.

 

How to bind the live data in Blazor Live DataGrid?

To bind live data without refreshing the entire data, we can use the SetRowData() method of the Blazor Grid Component.

 

Refer to the below code example.

 

CSHTML

<SfGrid @ref="Grid" DataSource="@GridData" Height="300" Width="1000" EnableVirtualization="true" EnableColumnVirtualization="true"> 
    <GridColumns> 
        @foreach (var prop in typeof(Order).GetProperties()) 
        { 
            <GridColumn Field="@prop.Name" IsPrimaryKey="@(prop.Name == "OrderID")" Width="90"></GridColumn> 
        } 
    </GridColumns> 
</SfGrid> 
  
@code{ 
    private static System.Timers.Timer aTimer; 
    SfGrid<Order> Grid { get; set; } 
. . . . . . . .  
    public void OnTimerEvent(Object source, ElapsedEventArgs e) 
    { 
        if(skip > 90000) 
        { 
            skip = 0; 
        } 
        GridData[skip].CustomerID = "Updated"; 
        GridData[skip].EmployeeID = 0; 
        GridData[skip].ShipCity = "Updated"; 
        GridData[skip].ShipCountry = "Updated"; 
        Grid.SetRowData(GridData[skip].OrderID, GridData[skip]); 
        skip = skip + 1;         
        InvokeAsync(StateHasChanged); 
    } 
 

 

 

Reference

You can get a runnable sample for the Blazor Live DataGrid from this link.



Conclusion

I hope you enjoyed learning how to start creating and binding live data in Blazor DataGrid.

You can refer to our Blazor DataGrid feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Blazor DataGrid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

 

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please  to leave a comment
Access denied
Access denied